﻿using System;
using System.Collections.Generic;
using System.Text;
using log4net;

namespace Possan.IOC
{
	class Logger
	{
		public static void Initialize()
		{
			log4net.Config.XmlConfigurator.Configure();
		}

		static ILog GetLogger(Type caller)
		{
			string typename = "Possan.IOC";
			if (caller != null)
				typename = caller.FullName;
			return LogManager.GetLogger(typename);
		}

		public static void Debug(Type where, string what)
		{
			GetLogger(where).Debug(what);
		}

		public static void Info(Type where, string what)
		{
			GetLogger(where).Info(what);
		}

		public static void Error(Type where, Exception what)
		{
			GetLogger(where).Error(what.ToString());
		}

		public static void Error(Type where, string what)
		{
			GetLogger(where).Error(what);
		}

		public static void Warning(Type where, Exception what)
		{
			GetLogger(where).Warn(what.ToString());
		}

		public static void Warning(Type where, string what)
		{
			GetLogger(where).Warn(what);
		}
	}
}
